package org.zwd.computePrice.domain;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Total {
	private int pay;
	private int realPay;
	private double maleNum;
	private double femaleNum;
	private double number;
	private List<Order> orderList = new ArrayList<Order>();
	private List<Crab> totalCrabList = new ArrayList<Crab>();
	private Map<Integer,Double> crabmap = new HashMap<Integer,Double>();
	
	
	public Total(List<Order> orderList) {
		this.orderList = orderList;
			if(orderList != null && orderList.size()>0){
			for(Order order : this.getOrderList()){
				this.pay += order.getTotalPay();
				this.realPay += order.getRealPay();
				this.maleNum += order.getTotalMaleNum();
				this.femaleNum += order.getTotalFemaleNum();
				this.number += order.getTotalNumber();
				if(order.getCrabList() != null && order.getCrabList().size() > 0){
					for(Crab crab : order.getCrabList()){
							if(this.crabmap.containsKey(crab.getId())){
								this.crabmap.put(crab.getId(), this.crabmap.get(crab.getId())+crab.getNumber());
							}else{
								this.crabmap.put(crab.getId(), crab.getNumber());
							}
					}
				}
				
			}
		}
	}

	public Total() {
		
	}
	
	public List<Order> getOrderList() {
		return orderList;
	}
	public void setOrderList(List<Order> orderList) {
		this.orderList = orderList;
	}
	
	public int getPay() {
		return pay;
	}
	public double getMaleNum() {
		return maleNum;
	}
	public double getFemaleNum() {
		return femaleNum;
	}
	public double getNumber() {
		return number;
	}
	public int getRealPay() {
		return realPay;
	}
	public Map<Integer, Double> getCrabmap() {
		return crabmap;
	}

	public List<Crab> getTotalCrabList() {
		return totalCrabList;
	}

	public void setTotalCrabList(List<Crab> totalCrabList) {
		this.totalCrabList = totalCrabList;
	}
}
